package com.yt.user.service;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.user.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.user.mapper.CustomerInfoMapper;
import com.yt.user.models.service.ICustomerInfoService;
import com.yt.user.models.bo.CustomerInfoSaveBO;
import com.yt.user.models.dto.CustomerInfoDTO;
import java.util.Date;

/**
 * 客户信息控制器
 *
 * @author yzz
 * @Date 2025-09-03 14:13:56
 */
@DubboService
public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfoDTO> implements ICustomerInfoService{

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(CustomerInfoSaveBO saveBO) {
        CustomerInfoDTO dto = new CustomerInfoDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        // 设置创建时间和更新时间
        Date now = new Date();
        dto.setCreateTime(now);
        dto.setUpdateTime(now);
        return this.insert(dto);
    }
}